import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		userId: null, // 登录用户ID
		userInfo: {}, // 用户信息
		networkState: true, // 网络状态
		
	},
	mutations: {
		/**
		 * 用户信息
		 * @param {Object} state
		 * @param {Object} event
		 */
		setUserInfo (state, userInfo) {
			state.userInfo = userInfo
		},
		setLoginUserId (state, userId){
			state.userId = userId
		},
		/**
		 * 网络状态
		 * @param {Object} state
		 * @param {Object} networkState
		 */
		setNetworkState(state, networkState){
			state.networkState = networkState;
		}
	}
})

export default store
